<template>
	 
	<view>
		<global-nav-bar left-icon="back" title="项目保养计划" @setHeight="setHeight" :fixed="false" backgroundColor="#2C2C2C"
        color="#fff" @clickLeft="handleBack"></global-nav-bar>
		<view class="tops">
			<view class="top" >
				<view class="top_tit">
					<image src="/static/images/index/itemPro.png" style="width: 32rpx;height: 32rpx;" alt="" srcset=""></image>
					<text>{{optName}}</text>
				</view>
			</view>
			<view class="top_down">
				<view class="down_all" @click="todayClick">
					<image src="@/static/images/index/today.png" mode=""></image>
            		<text>今天</text>
				</view>
				<view style="height: 28rpx; width: 2rpx; background: #eee; margin:8rpx 24rpx 0 24rpx;"></view>
				<view class="down_all" @click="selectElevator">
					<!-- <image src="@/static/images/filter1.png" style="width: 32rpx;height: 32rpx;" alt="" srcset=""></image> -->
					<image src="@/static/images/index/selectA.png" mode="" v-if="selectArr && selectArr.length"></image>
					<image src="@/static/images/index/selectD.png" mode="" v-else></image>
					<text :style="{ color: selectArr.length ? '#0091ff' : '#666' }">{{selectArr.length?'已筛选('+selectArr.length+')':'全部梯'}} </text>
				</view>
				<view style="height: 28rpx; width: 2rpx; background: #eee; margin:8rpx 24rpx 0 24rpx;"></view>
				<view class="down_all" @click="selectDown">
					<image src="@/static/images/download.png" style="width: 32rpx;height: 32rpx;" alt="" srcset="" mode="" />
					<text>下载计划</text>
				</view>
			</view>
			
		</view>
		<!-- 日历组件 -->
		<view :style="{height:mheight+'px'}" >
			<monthPlanCom ref="monthPlanCom" :mheight="mheight" :monthArrs="monthArrs" @select="selectTime" @loadScrollMonth="loadScrollMonth" />
		</view>
		
		<!-- 筛选组件 -->
		<filter-drawer :isFilterList="{name:optName}" :chooseData="choosed" :filterList="filterList" :comfireText="comfireText" :show="showFilter"
			:keyMap="keyMap" title="保养计划下载设置" mainTips="(请选择需要查看保养计划的时间范围)" ref="filter-drawer" :isMainPlan="true" :dateLists="dateLists"
			:orderType="orderType" :countState="countState" :isShowDate="false" @closed="handleClose" @submit="submitFilter"
			@chooseTag="getResultCount" @defaultReset="defaultReset" @customerOpenTime="customerOpenTime" >
      <template v-slot:dateFilterBottom>
        <view class="begin-time" v-if="curValue===10 && (curStartDate || curEndDate)"><text>已选：</text><text>{{formatDisplayTime(curStartDate, curEndDate)}}</text></view>
      </template>
    </filter-drawer>
		<!-- 完成时间 -->
		<time-select v-if="selectTimePopup" :beforeToday="beforeToday" :atterToday="true" :isChooseToday="isChooseToday"
                 :default-model="timeSelectModel"
                 :default-select-time="defaultDate"
			@close="closeSelectTimePopup"></time-select>
		<!-- 电梯组件 -->
		<selectElevator 
		:depElevatorList="depElevatorList" 
		 @changeTab="changeTab" 
		 @changeStatus="changeStatus"
		 @chooseItem="chooseItem"
		 @closedSele="closedr" 
		 @submit="submit"
		  ref="groupSelect" 
		/>
		 <!-- 下载成功对话框 -->
		 <model
			width="508rpx"
			:visible="successVisible"
			title="成功导出保养计划"
			cancleTxt="复制链接"
			comfireTxt="直接打开"
			@cancle="copyLink"
			@comfire="openFile"
		>
		<view class="conte">
          <view class="modelItem"> 你可以直接打开，或者复制链接至 </view>
          <view class="modelItem"> 电脑端浏览器下载。 </view>
        </view>
		</model>
	</view> 
</template>

<script>
import monthPlanCom  from '@/components/dateSelect/monthPlanCom.vue';
import aiprogress  from '@/components/ai-progress/ai-progress.vue';
import filterDrawer from '@/components/filter-drawer/filterDrawer.vue';
import timeSelect from '@/pages/index/components/timeSelect.vue';
import model from '@/components/model/index.vue';
import selectElevator from './components/selectElevator.vue';
import GlobalNavBar from '@/components/uni-nav-bar/global-nav-bar';

import dayjs from 'dayjs';
import { mapState, mapActions } from 'vuex';
import { projectDetail, myElevator, deptElevatorList } from '@/apis/project.js';
import {calendarPlan,calendarPlanExcel,calendarStatisticsCount} from '@/apis/maintains.js';
import { getNowTime,removeEmpty,hanleToken } from '@/utils/utils.js';
export default {
	components:{
		GlobalNavBar,
		monthPlanCom,
		filterDrawer,
		timeSelect,
		selectElevator,
		aiprogress,
		model
	},
	data() {
		return {
			overflowShow:false,
			monthArrs:{},
			selectTimePopup: false,
			showFilter:false,
			allChecked: true,
			choosed:{},
			chooseArr:[],
			filterList: [
				{ title: '按电梯查找', key: 'useTypes', tips:'请选择需要查看保养计划的电梯范围', list: [{ name: '全部电梯', value: 0 },] }
			],
			keyMap:{},
			orderType:0,
			typeForm:2,
			comfireText: '确定',
			dateObj: {
				startTime: '',
				endTime: '',
				planBeginDate: '',
				planEndDate: '',
				value: '',
				value2: ''
			},
			dateLists:[
				{ name: '今天', value: 1 },
				{ name: '本周', value: 2 },
				{ name: '本月', value: 3 },
				// { name: '后1个自然月', value: 4 },
				// { name: '后2个自然月', value: 5 },
				// { name: '后3个自然月', value: 6 },
				{ name: '下月', value: 4 },
				{ name: '后3个月', value: 7 },
				{ name: '后6个月', value: 8 },
				{ name: '本年', value: 9 },
				{ name: '自定义时间', value: 10 },
			],
          
			optionKey:'',// 日期组件key
			beforeToday: true,// 日期组件
			isChooseToday: true,// 日期组件

			depElevatorList:[],
			selectArr:[],// 选择的电梯
			eleAllIds:[],// 全部电梯id
			optBuildingId:'',
			successVisible:false,
			tempFilePath:'',
			optName:'',
			startDate:'',
			endDate:'',
			mheight:0,
			countState:0,// 保养计划数量
			curValue:0,// 计划时间的value值
			curStartDate:'',// 自定义日期
			curEndDate:'',// 自定义日期
			choosed1: [], // 部门单次电梯选择
			choosed2: [], // 个人 全部
			choosed3: [], // 个人 责任
			// 时间选择组件模式
			timeSelectModel: 'date',
			defaultDate: []
		};
	},
	computed: {
		...mapState('user', ['userinfo']),
	},
	created() {
		
	},	
	async onLoad(opt) {
		uni.getSystemInfo({
			success: (res) => {
				this.mheight = res.windowHeight - 94 - 91;
			},
		});
		this.optBuildingId = opt.buildingId || '';
		this.optName = opt.name || '';
		this.initElevator(2,opt.buildingId);
		this.eleAllIds = hanleToken('get','elevatorIdAll');
		if (this.eleAllIds && this.eleAllIds.length) {
			// 默认加载7个月数据
			this.startDate = dayjs(new Date().getTime() - 1000 * 60 * 60 * 24).subtract(2, 'month').format('YYYY-MM-DD');
			this.endDate = dayjs(new Date().getTime() - 1000 * 60 * 60 * 24).add(4, 'month').format('YYYY-MM-DD');
			this.initPlanDateData(this.eleAllIds,this.startDate,this.endDate);
		}
	},
	onUnload() {
		
	},
	onHide() {
		
	},
	methods:{
		setHeight(n) {
		// this.mheight = n
		// console.log('n', n)
		},
			
		// 初始加载电梯
		initElevator(type,buildingId,eleClassify = 0) {
			let objs = {
				buildingId,
				size:100,
    			userId:this.userinfo.user_id,
			};
			if (eleClassify) {// 个人责任梯区分参数
				objs.eleClassify = '0';
			}
			(type === 1 ? myElevator : deptElevatorList)(objs).then(res=>{
				if (res.code === 200) {
					this.$nextTick(()=>{
						this.depElevatorList = res.data || [];
						this.depElevatorList.forEach(item => {
							if (type == 2) {
								this.choosed1.forEach(it => {
									if (it.elevatorId == item.elevatorId) {
										item.choosed = true;
									}
								});
							}
							if (type == 1 && eleClassify == 0) {
								this.choosed2.forEach(it => {
									if (it.elevatorId == item.elevatorId) {
										item.choosed = true;
									}
								});
							}
							if (type == 1 && eleClassify == 1) {
								this.choosed3.forEach(it => {
									if (it.elevatorId == item.elevatorId) {
										item.choosed = true;
									}
								});
							}
						});
					});
				}
			});
		},
		// 初始加载日历排期数据
		initPlanDateData(elevatorIds = [],startDate,endDate,arrow) {
			uni.showLoading({
				title: '加载中',
				icon: 'none'
			});
			calendarPlan({
				elevatorIds,
				startDate,
				endDate
			}).then(res=>{
				uni.hideLoading();
				if (res.code === 200) {
					this.monthArrs = res.data || {};
					this.$refs['monthPlanCom'].initDate(this.monthArrs, arrow);
				}
			}).catch(err=>{
				uni.hideLoading();
			});
		},
		// 电梯排期下载excel
		initElevatorExcel(elevatorIds,startDate,endDate,type) {
			uni.showLoading({
				title:'下载中',
				icon:'none'
			});
			calendarPlanExcel({
				buildingId: this.optBuildingId,
				elevatorIds,
				startDate,
				endDate,
				type
			}).then(res=>{ 
				this.successVisible = true;
				if (res.code === 200) {
					let excelURl = res.data || '';
					let str = excelURl.split('/')[excelURl.split('/').length - 1];
					this.excelURl = excelURl;

					// #ifdef h5
					uni.hideLoading();
					// #endif

					// #ifndef H5
					uni.downloadFile({
						url: res.data, 
						filePath: wx.env.USER_DATA_PATH + '/' + str,
						success:(data)=> { 
							if (data.statusCode === 200) {
							// this.tempFilePath = data.tempFilePath;
								this.tempFilePath = data.filePath;
								uni.hideLoading();
							}
						},
					});
					// #endif
				}
			});
		},
		openFile() { 
			// #ifdef H5
			sida.openUrl({ url: this.excelURl });        
			// #endif

			// #ifndef H5
			uni.openDocument({
				filePath: this.tempFilePath,
				showMenu:true,
				fileType:'xlsx',
				success:  (res)=> { 
					this.successVisible = false;
				},
				fail:(err)=>{
					console.log(err);
				}
			});
			// #endif
		},
		// 复制链接
		copyLink() {
			uni.setClipboardData({
				data: this.excelURl,
				success: (res) => {
					uni.getClipboardData({
						success(res) { 
						},
					});
					this.successVisible = false;
				},
			});
		},

		todayClick() {
			this.initPlanDateData(this.eleAllIds,this.startDate,this.endDate);
		},

		loadScrollMonth(obj,count,arrow) {
			let startDate = dayjs(obj.year + '-' + (obj.month > 9 ? obj.month : '0' + obj.month)).format('YYYY-MM-DD');
			let endDate = dayjs(obj.year + '-' + (obj.month > 9 ? obj.month : '0' + obj.month)).add(4, 'month').format('YYYY-MM-DD');
			if (count === -1) {
				endDate = obj.year + '-' + (obj.month > 9 ? obj.month : '0' + obj.month) + '-' + '01';
				startDate = dayjs(obj.year + '-' + (obj.month > 9 ? obj.month : '0' + obj.month)).subtract(3, 'month').format('YYYY-MM-DD');
			}
			// if(inits > 1){
			let resArr = this.selectArr.length ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds;
			this.initPlanDateData(resArr,startDate,endDate,arrow);
			// }
		},
		// 选择电梯
		chooseItem({ choosed, tabIdx, statusActive, clearAll }) {
			if (tabIdx == 2) {
				this.choosed1 = choosed;
			}
			if (tabIdx == 1 && statusActive == 0) {
				this.choosed2 = choosed;
			}
			if (tabIdx == 1 && statusActive == 1) {
				this.choosed3 = choosed;
			}
			if (clearAll) {
				this.choosed1 = this.choosed2 = this.choosed3 = [];
			}
		},
		
		// 点击月历
		selectTime(item,year,month) {
			if (!item.planObj.elevatorCount) {
				uni.showToast({
					title: '该日期无保养计划',
					icon: 'none',
				});
				return;
			}
			let strTime = year + '-' + (month > 9 ? month : '0' + month) + '-' + (item.date > 9 ? item.date : '0' + item.date);
			let eleIds = [];
			if (this.selectArr && this.selectArr.length) {
				eleIds = this.selectArr.map(item=>item.elevatorId);
			}
			uni.navigateTo({
				url:'/subpages/maintenanceStatistics/index?mainPlan=1' + '&planTimes=' + strTime + '&buildingId=' + this.optBuildingId + '&eleIds=' + JSON.stringify(eleIds)
			});
		},
		// 选择梯
		selectElevator() {
			this.overflowShow = true;
			this.$refs.groupSelect.showDrawer = true;
			this.$refs['monthPlanCom'].arrowState = 1;
			if (this.findRoute('depart_elevator')) {
				this.initElevator(2,this.optBuildingId);
			} else if (this.findRoute('personal_elevator')) {
				this.initElevator(1,this.optBuildingId);
			}
		},
		// 关闭选择电梯
		closedr() { 
			this.overflowShow = false;
			this.$refs.groupSelect.handleReset(); 
      		this.$refs.groupSelect.tabIdx = 2;
			// this.$refs['monthPlanCom'].arrowState = 1
			// this.$refs['filter-drawer'].defaultPlan({value:3})
		},
		// 部门个人梯切换
		changeTab(index) {
			this.initElevator(index,this.optBuildingId);
		},
		// 个人责任梯
		changeStatus(index) {
			this.initElevator(1,this.optBuildingId,index);
		},
		// 点击下载计划
		selectDown() {
			this.overflowShow = true;
			this.showFilter = true;
			this.curEndDate = '';
			this.curStartDate = '';
			this.defaultDate = [];
			this.timeSelectModel = 'date';
			let objs = {
				elevatorIds:this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds,
				planBeginDate:this.startDate,planEndDate:this.endDate,cuValue:3
			};
			this.handleCount(objs);
			this.$nextTick(()=>{
				this.$refs['filter-drawer'].choosed['useTypes'] = [0];
				this.$refs['filter-drawer'].defaultPlan({value:3});
			});
		},
		 // 弹窗后点击日期
		customerOpenTime(objs) {
			this.selectTimePopup = objs.isState;
		},
		// 自定义日期 --完成时间
		closeSelectTimePopup(res, model) {
			let start = '';
			let end = '';
			if (model) {
				this.timeSelectModel = model;
			}
			if (res) { 
				if (res.indexOf('-') != -1) {
					const timeArr = res.split('-');
					start = timeArr[0].replaceAll('.', '-');
					end = timeArr[1].replaceAll('.', '-');
				} else {
					const time = res.replaceAll('.', '-');
					start = time;
					end = time;
				}
				const nowDay = getNowTime();
				let nowtime = new Date(nowDay).getTime();
				let starttime = new Date(start).getTime();
				let endtime = new Date(end).getTime();
				if (endtime >= nowtime && !this.beforeToday && !this.isChooseToday) { 
					uni.showToast({
						title: '自定义日期范围须小于今天',
						icon: 'none',
					});
					return;
				}
			} else {
			}
			if (start && end) {
				this.curStartDate = start;
				this.curEndDate = end;
				this.defaultDate = [start, end];
				// 这里消息会触发handleCount
				uni.$emit('closeTimeSelectPlan', { start, end,value:10});// 向兄弟组件回显日期
				// 会重复调用，暂时屏蔽
				// let objs = {elevatorIds:this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds,planBeginDate:start,planEndDate:end,cuValue:7};
				// this.handleCount(objs);
			}
			this.selectTimePopup = false;
		},
		submit(res) {
			this.overflowShow = false;
			this.selectArr = res.selectArr;
			this.filterList[0].list[0].name = '全部电梯';
			this.$refs['filter-drawer'].choosed['useTypes'] = [0];
			// this.$refs['monthPlanCom'].initDate()//重新更新月历数据
			let arrs = this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds;
			this.initPlanDateData(arrs,this.startDate,this.endDate);// 重新更新月历数据
			if (res.selectArr && res.selectArr.length > 0) {
				this.filterList[0].list[0].name = res.selectArr.length + '台电梯';
				let objs = {elevatorIds:arrs,planBeginDate:this.curStartDate || '',planEndDate:this.curEndDate || '',cuValue:this.curValue || 3};
				this.handleCount(objs);
			}
		},

		handleClose() {
			this.showFilter = false;
			this.curEndDate = '';
			this.curStartDate = '';
			this.defaultDate = [];
			this.timeSelectModel = 'date';
			let obj = {};
			this.chooseArr.forEach(item => {
				if (obj[item.key]) {
					obj[item.key].push(item.value);
				} else {
					obj[item.key] = [];
					obj[item.key].push(item.value);
				}
			});
			this.choosed = obj;
		},
		// 点击标签的时候
		getResultCount(res) {
			if (res.cuValue) {
				this.curValue = res.cuValue;
			}
			if (res) {
				this.$nextTick(()=>{
					if (res.choosed.useTypes && res.choosed.useTypes.length && res.hasOwnProperty('value') ) {
						this.$refs.groupSelect.initData(); 
					} else {
						this.handleCount(res);
					}
				});
			}
		},

		// 完成筛选
		filterd(res) {
			let obj = JSON.parse(JSON.stringify(res.dateObj));
			if (obj.startTime && obj.startTime.indexOf(':') == -1) {
				obj.startTime = obj.startTime + ' 00:00:00';
			}
			if (obj.endTime && obj.endTime.indexOf(':') == -1) {
				obj.endTime = obj.endTime + ' 23:59:59';
			}

			if (obj.planBeginDate && obj.planBeginDate.indexOf(':') == -1) {
				obj.planBeginDate = obj.planBeginDate + ' 00:00:00';
			}
			if (obj.planEndDate && obj.planEndDate.indexOf(':') == -1) {
				obj.planEndDate = obj.planEndDate + ' 23:59:59';
			}
			let planBeginDate = '';
			let planEndDate = '';

			// 处理特殊类型：后6个月和本年
			if (obj.value2 === 8 || obj.value2 === 9) {
				const now = new Date();
				if (obj.value2 === 8) { // 后6个月
					// 从下月1日开始到6个月后的月末
					const startDate = new Date(now.getFullYear(), now.getMonth() + 1, 1);
					const endDate = new Date(now.getFullYear(), now.getMonth() + 7, 0);

					// 格式化日期
					planBeginDate = this.formatDate(startDate);
					planEndDate = this.formatDate(endDate);
				} else if (obj.value2 === 9) { // 本年
					// 本年1月1日到12月31日
					const startDate = new Date(now.getFullYear(), 0, 1);
					const endDate = new Date(now.getFullYear(), 11, 31);

					// 格式化日期
					planBeginDate = this.formatDate(startDate);
					planEndDate = this.formatDate(endDate);
				}
			} else {
				if (!obj.value2 || obj.value2 === 10) {
					obj.value2 = 7;
					planBeginDate = res.dateObj.planBeginDate;
					planEndDate = res.dateObj.planEndDate;
				}
			}
			if ([8,9,10].includes(res.cuValue)) {
				obj.value2 = 7;
			}
			let arr = this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds;
			this.initElevatorExcel(arr,planBeginDate,planEndDate,obj.value2 - 1);
			this.initPlanDateData(this.eleAllIds,this.startDate,this.endDate);// 重新更新月历数据
		},
		// 保存筛选
		submitFilter(res) { 
			if (!this.countState) {
				return;
			}
			this.keyMap = res.keyMap;
			this.allChecked = res.allChecked;
			this.choosed = res.choosed;
			this.showFilter = false;
			
			this.filterd(res);
			this.handleResetting();
		},
		handleResetting() {
			this.comfireText = '确定0个计划';
			this.countState = 0;
			this.selectArr = [];
			this.filterList[0].list[0].name = '全部电梯';
			this.$refs['filter-drawer'].choosed['useTypes'] = [0];
			this.$refs['groupSelect'].handleReset();
		},
		// 重置默认
		defaultReset() {
			// this.comfireText = `确定0个计划`;
			// this.countState = 0
			this.curEndDate = '';
			this.curStartDate = '';
			this.defaultDate = [];
			this.timeSelectModel = 'date';
			this.selectArr = [];
			this.filterList[0].list[0].name = '全部电梯';
			this.$refs['groupSelect'].handleReset();
			this.$refs['filter-drawer'].mianPlanReset({key:'useTypes',value:0});
			this.$refs['filter-drawer'].defaultPlan({value:3});
			let objs = {elevatorIds:this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds,planBeginDate:'',planEndDate:'',cuValue:3};
			this.handleCount(objs);
		},
		
		// 获取点击筛选条件后的数量总数	
		async handleCount(res) {
			const { allChecked, choosed,reset,cuValue } = res;
			if (reset) {
				this.handleResetting();
				return;
			}
			if (!cuValue) {
				this.comfireText = '确定0个计划';
				this.countState = 0;
				return;
			}
			let params = {
				elevatorIds: this.selectArr && this.selectArr.length > 0 ? this.selectArr.map(item=>item.elevatorId) : this.eleAllIds,
				startDate:res.planBeginDate,
				endDate:res.planEndDate,
				type:res.cuValue - 1 || 0,// 日期选择的类型
			};
			if (Object.keys(res).length ) {
				console.log(2222222);
				// let resultObjs = removeEmpty(params)
				let count = await this.handleGetCount(params);
				this.countState = count;
				if (count > 0) {
					this.comfireText = `确定${count}个计划`;
				} else {
					uni.showToast({
						icon: 'none',
						title: '筛选结果为空 请重新选择条件'
					});
					this.countState = 0;
					this.comfireText = '确定0个计划';
				}
			}
		},
		// 获取计划数量
		handleGetCount(objs) {
			return new Promise((resolve,reject)=>{
				calendarStatisticsCount(objs).then(res=>{
					if (res.code === 200) {
						let arrs = res.data || [];
						resolve(arrs);
					}
				});
			}).catch((err)=>reject([]));
		},
		// 格式化日期的辅助方法
		formatDate(date) {
			const year = date.getFullYear();
			const month = (date.getMonth() + 1).toString().padStart(2, '0');
			const day = date.getDate().toString().padStart(2, '0');
			return `${year}-${month}-${day}`;
		},
		// 格式化显示时间
		formatDisplayTime(start, end) {
			if (!start || !end) return '';

			// 解析日期
			const startDate = new Date(start.replace(/\//g, '-'));
			const endDate = new Date(end.replace(/\//g, '-'));

			const startYear = startDate.getFullYear();
			const startMonth = (startDate.getMonth() + 1).toString().padStart(2, '0');
			const endYear = endDate.getFullYear();
			const endMonth = (endDate.getMonth() + 1).toString().padStart(2, '0');

			// 检查是否跨年度
			if (this.timeSelectModel === 'year') {
				if (startYear === endYear) {
					return `${startYear}`;
				}
				return `${startYear}，${endYear}`;
			}
			// if (startYear !== endYear) {
			// 	return `${startYear}，${endYear}`;
			// }

			// 检查是否为月份的第一天和最后一天
			// const isMonthStart = startDate.getDate() === 1;
			// const isMonthEnd = endDate.getDate() === new Date(endYear, endDate.getMonth() + 1, 0).getDate();
			//
			// 如果是月份的开始和结束，显示年-月格式
			// if (isMonthStart && isMonthEnd &&
			// 	(endDate.getMonth() - startDate.getMonth() > 0 || endYear > startYear)) {
			// 	return `${startYear}-${startMonth}至${endYear}-${endMonth}`;
			// }
			if (this.timeSelectModel === 'month') {
				if (startYear === endYear && startMonth === endMonth) {
					return `${startYear}-${startMonth}`;
				}
				return `${startYear}-${startMonth}至${endYear}-${endMonth}`;
			}
			// 默认显示原始格式
			return `${start}至${end}`;
		},
	}

};
</script>

<style lang="scss" scoped>
.conte{
   display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0rpx 0 40rpx 0;
    .modelItem{
      font-size: 28rpx;
      color: #333333;
    }
}

.tops{
	// position: sticky;
    // top: 0;
    // left: 0;
	// background: #ffffff;
	// z-index: 99;
}
.top{
	padding: 0 20rpx;
	border-bottom:2rpx #eeeeee solid;
	background: #ffffff;
	height: 60rpx;
	line-height: 46rpx;
	.top_tit{
		margin:10rpx 0;
		font-size: 26rpx;
		color: #666666;
		image{
			vertical-align: middle;
			margin-right: 10rpx;
		}
		text{
			vertical-align: middle;
		}
	}
}
.top_down{
	display: flex;
	font-size: 26rpx;
	color: #666666;
	justify-content: flex-end;
	padding: 0 20rpx;
	margin-top: 20rpx;
	// margin-bottom: 40rpx;
	background: #ffffff;
	height: 60rpx;
	// z-index: 99;
	.down_all{

		image{
			vertical-align: middle;
			margin-right: 10rpx;
			width: 32rpx;
			height: 32rpx;
		}
		text{
			vertical-align: middle; 
		}
	}
	
}

</style>
